package entity;

/**
 * Created by chengxiaoqi1 on 2018/5/17.
 */
public class Student {
    public String name;
    protected int age;
    char sex;
    private String phoneNum;


    Student(String str) {
        System.out.println("默认构造方法, str" + str);
    }

    public Student() {
        System.out.println("无参构造方法");
    }

    public Student(char name) {
        System.out.println("一个参数的构造方法, name=" + name);
    }

    public Student(String name, int age) {
        System.out.println("多个参数构造方法, name=" + name + ",age=" + age);
    }

    protected Student(boolean b) {
        System.out.println("受保护的构造方法");
    }

    private Student(int age) {
        System.out.println("受保护的构造方法: age=" + age);
    }

    public int getAge() {
        return age;
    }

    public void setAge(int age) {
        this.age = age;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", age=" + age +
                ", sex=" + sex +
                ", phoneNum='" + phoneNum + '\'' +
                '}';
    }

    public void show1(String s) {
        System.out.println("调用了：公有的，String参数的show1(): s = " + s);
    }

    protected void show2() {
        System.out.println("调用了：受保护的，无参的show2()");
    }

    void show3() {
        System.out.println("调用了：默认的，无参的show3()");
    }

    private String show4(int age){
        System.out.println("调用了，私有的，并且有返回值的，int参数的show4(): age = " + age);
        return "abcd";
    }

}
